<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<f:view>
	<h:head>
		<title>Daily_plan</title>
		<h:outputStylesheet library="css" name="bootstrap.css" />
	</h:head>
	<h:body>
		<div class="modal" style="width: 60%; left: 40%; z-index: 0">
			<h:form id="myForm" styleClass="form-horizontal modal-form">
				<div class="modal-header">
					<div style="vertical-align: middle;">
						<h2 style="display: inline; vertical-align: middle">
							<h:outputText value="#{dailyPlanBean.user.fullName}" />
						</h2>
						<h:outputLink value="info.xhtml">
								<f:param name="id"  value = "#{dailyPlanBean.user.id}"  />
								<h:graphicImage library="img" name="info.png" width="25" height="25"/>
							</h:outputLink>
					</div>
					<p:calendar id="popupButtonCal" showOn="button"
						style="margin-bottom:0px" value="#{dataHolderBean.date}">
						<p:ajax event="dateSelect"
							listener="#{dailyPlanBean.handleCalendarChange}" update="grid" />
					</p:calendar>
				</div>
				<div class="modal-body">
					<p:outputPanel id="grid">
						<h:panelGroup class="alert alert-warn" style="display:block"
							rendered="#{dailyPlanBean.tasksFlag == false}">
							<strong>Sorry, there are not tasks for this date... </strong>
						</h:panelGroup>
						<h:dataTable id="tasks"
							value="#{dailyPlanBean.dailyPlan.taskList}"
							styleClass="table table-bordered" var="data"
							rendered="#{dailyPlanBean.tasksFlag}">
							<h:column>
								<f:facet name="header"></f:facet>
								<p:selectBooleanCheckbox value="#{data.selected}" />
							</h:column>
							<h:column>
								<f:facet name="header">Event</f:facet>
								#{data.event}
								</h:column>
							<h:column>
								<f:facet name="header">Time</f:facet>
								#{data.time}
								</h:column>
							<h:column>
								<f:facet name="header">Estimate duration</f:facet>
									#{data.estimateDuration}
								</h:column>
							<h:column>
								<f:facet name="header">Actual duration</f:facet>
									#{data.actualDuration}
								</h:column>
							<h:column>
								<f:facet name="header">Comments</f:facet>
								#{data.comments}
								</h:column>
						</h:dataTable>
					</p:outputPanel>
					<h:panelGroup class="alert alert-error" style="display:block"
						rendered="#{dailyPlanBean.errorMessage != null}">
						<strong>Error occured! </strong>
						<h:outputText value="#{dailyPlanBean.errorMessage}" />
					</h:panelGroup>
				</div>
				<div class="modal-footer">
					<h:commandButton value="Create" styleClass="btn btn-primary"
						action="#{dailyPlanBean.create}"
						rendered="#{dailyPlanBean.loggedInUserFlag}" />
					<h:commandButton value="Edit" styleClass="btn"
						action="#{dailyPlanBean.edit}"
						rendered="#{dailyPlanBean.loggedInUserFlag}" />
					<h:commandButton value="Delete" styleClass="btn"
						action="#{dailyPlanBean.delete}"
						rendered="#{dailyPlanBean.loggedInUserFlag}" />
					<h:link value="Back" styleClass="btn" outcome="admin"
						rendered="#{!dailyPlanBean.loggedInUserFlag}" />
				</div>
			</h:form>
		</div>
	</h:body>
</f:view>
</html>